home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume21 / amd / part03 < prev    next >
Encoding:
Internet Message Format  |  1990-04-11  |  54.8 KB

  1. Subject:  v21i091:  An Automounter for NFS systems, Part03/13
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: 8c225961 025000eb c984a648 08a39cf0
  5.  
  6. Submitted-by: Jan-Simon Pendry <jsp@doc.ic.ac.uk>
  7. Posting-number: Volume 21, Issue 91
  8. Archive-name: amd/part03
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 3 (of 13)."
  17. # Contents:  am_ops.c amq.h amq_clnt.c doc/nh.sty ifs_ops.c mount.x
  18. #   mount_xdr.c os-bsd44.h os-u2_2.h os-u3_0.h pfs_ops.c
  19. #   scripts/mk-home-maps srvr_afs.c ufs_ops.c
  20. # Wrapped by rsalz@papaya.bbn.com on Tue Apr 10 15:12:00 1990
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f 'am_ops.c' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'am_ops.c'\"
  24. else
  25. echo shar: Extracting \"'am_ops.c'\" \(3174 characters\)
  26. sed "s/^X//" >'am_ops.c' <<'END_OF_FILE'
  27. X/*
  28. X * $Id: am_ops.c,v 5.1.1.1 89/11/28 17:39:32 jsp Exp Locker: jsp $
  29. X *
  30. X * Copyright (c) 1989 Jan-Simon Pendry
  31. X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  32. X * Copyright (c) 1989 The Regents of the University of California.
  33. X * All rights reserved.
  34. X *
  35. X * This code is derived from software contributed to Berkeley by
  36. X * Jan-Simon Pendry at Imperial College, London.
  37. X *
  38. X * Redistribution and use in source and binary forms are permitted
  39. X * provided that the above copyright notice and this paragraph are
  40. X * duplicated in all such forms and that any documentation,
  41. X * advertising materials, and other materials related to such
  42. X * distribution and use acknowledge that the software was developed
  43. X * by Imperial College of Science, Technology and Medicine, London, UK.
  44. X * The names of the College and University may not be used to endorse
  45. X * or promote products derived from this software without specific
  46. X * prior written permission.
  47. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  48. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  49. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  50. X *
  51. X *    %W% (Berkeley) %G%
  52. X */
  53. X
  54. X#include "am.h"
  55. X
  56. Xstatic am_ops *vops[] = {
  57. X#ifdef HAS_UFS
  58. X    &ufs_ops,
  59. X#endif
  60. X#ifdef HAS_NFS
  61. X    &nfs_ops,
  62. X#endif
  63. X#ifdef HAS_SFS
  64. X    &sfs_ops,
  65. X#endif
  66. X#ifdef HAS_LOFS
  67. X    &lofs_ops,
  68. X#endif
  69. X#ifdef HAS_PFS
  70. X    &pfs_ops,
  71. X#endif
  72. X    &afs_ops,    /* These three should be last ... */
  73. X    &dfs_ops,    /* ... */
  74. X    &efs_ops,    /* ... in the order afs; dfs; efs */
  75. X    0
  76. X};
  77. X
  78. X#ifdef SUNOS4_COMPAT
  79. X/*
  80. X * Crack a SunOS4-style host:fs:sub-link line
  81. X * Construct an amd-style line and call the
  82. X * normal amd matcher.
  83. X */
  84. Xam_ops *sunos4_match(fo, key, g_key, path, keym, map)
  85. Xam_opts *fo;
  86. Xchar *key;
  87. Xchar *g_key;
  88. Xchar *path;
  89. Xchar *keym;
  90. Xchar *map;
  91. X{
  92. X    char *host = key;
  93. X    char *fs = strchr(host, ':');
  94. X    char *sublink = fs ? strchr(fs+1, ':') : 0;
  95. X    char keybuf[MAXPATHLEN];
  96. X
  97. X    sprintf(keybuf, "type:=nfs;rhost:=%s;rfs:=%s;sublink:=%s;opts:=%s", host,
  98. X        fs ? fs+1 : "",
  99. X        sublink ? sublink+1  : "",
  100. X        g_key);
  101. X    return ops_match(fo, keybuf, "", path, keym, map);
  102. X}
  103. X#endif /* SUNOS4_COMPAT */
  104. X
  105. Xam_ops *ops_match(fo, key, g_key, path, keym, map)
  106. Xam_opts *fo;
  107. Xchar *key;
  108. Xchar *g_key;
  109. Xchar *path;
  110. Xchar *keym;
  111. Xchar *map;
  112. X{
  113. X    am_ops **vp;
  114. X    am_ops *rop = 0;
  115. X
  116. X    /*
  117. X     * First crack the global opts and the local opts
  118. X     */
  119. X    if (!eval_fs_opts(fo, key, g_key, path, keym, map)) {
  120. X        rop = &efs_ops;
  121. X    } else if (fo->opt_type == 0) {
  122. X        plog(XLOG_USER, "No fs type specified (somewhere!)");
  123. X        rop = &efs_ops;
  124. X    } else {
  125. X        /*
  126. X         * Next find the correct filesystem type
  127. X         */
  128. X        for (vp = vops; rop = *vp; vp++)
  129. X            if (strcmp(rop->fs_type, fo->opt_type) == 0)
  130. X                break;
  131. X
  132. X        if (!rop) {
  133. X            plog(XLOG_USER, "fs type \"%s\" not recognised", fo->opt_type);
  134. X            rop = &efs_ops;
  135. X        }
  136. X    }
  137. X
  138. X    /*
  139. X     * Make sure we have a default mount option.
  140. X     * Otherwise skip past any leading '-'.
  141. X     */
  142. X    if (fo->opt_opts == 0)
  143. X        fo->opt_opts = "rw,defaults";
  144. X    else if (*fo->opt_opts == '-')
  145. X        fo->opt_opts++;
  146. X
  147. X    /*
  148. X     * Check the filesystem is happy
  149. X     */
  150. X    if ((*rop->fs_match)(fo))
  151. X        return rop;
  152. X
  153. X    /*
  154. X     * Return error file system
  155. X     */
  156. X    (void) (*efs_ops.fs_match)(fo);
  157. X    return &efs_ops;
  158. X}
  159. END_OF_FILE
  160. if test 3174 -ne `wc -c <'am_ops.c'`; then
  161.     echo shar: \"'am_ops.c'\" unpacked with wrong size!
  162. fi
  163. # end of 'am_ops.c'
  164. fi
  165. if test -f 'amq.h' -a "${1}" != "-c" ; then 
  166.   echo shar: Will not clobber existing file \"'amq.h'\"
  167. else
  168. echo shar: Extracting \"'amq.h'\" \(3382 characters\)
  169. sed "s/^X//" >'amq.h' <<'END_OF_FILE'
  170. X/*
  171. X * $Id: amq.h,v 5.1.1.1 90/01/11 17:01:34 jsp Exp Locker: jsp $
  172. X *
  173. X * Copyright (c) 1990 Jan-Simon Pendry
  174. X * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
  175. X * Copyright (c) 1990 The Regents of the University of California.
  176. X * All rights reserved.
  177. X *
  178. X * This code is derived from software contributed to Berkeley by
  179. X * Jan-Simon Pendry at Imperial College, London.
  180. X *
  181. X * Redistribution and use in source and binary forms are permitted
  182. X * provided that the above copyright notice and this paragraph are
  183. X * duplicated in all such forms and that any documentation,
  184. X * advertising materials, and other materials related to such
  185. X * distribution and use acknowledge that the software was developed
  186. X * by Imperial College of Science, Technology and Medicine, London, UK.
  187. X * The names of the College and University may not be used to endorse
  188. X * or promote products derived from this software without specific
  189. X * prior written permission.
  190. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  191. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  192. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  193. X *
  194. X *    %W% (Berkeley) %G%
  195. X */
  196. X
  197. X#define AMQ_STRLEN 1024
  198. X
  199. Xtypedef char *amq_string;
  200. Xbool_t xdr_amq_string();
  201. X
  202. X
  203. Xtypedef long *time_type;
  204. Xbool_t xdr_time_type();
  205. X
  206. X
  207. Xstruct amq_mount_tree {
  208. X    amq_string mt_mountinfo;
  209. X    amq_string mt_directory;
  210. X    amq_string mt_mountpoint;
  211. X    amq_string mt_type;
  212. X    time_type mt_mounttime;
  213. X    u_short mt_mountuid;
  214. X    int mt_getattr;
  215. X    int mt_lookup;
  216. X    int mt_readdir;
  217. X    int mt_readlink;
  218. X    int mt_statfs;
  219. X    struct amq_mount_tree *mt_next;
  220. X    struct amq_mount_tree *mt_child;
  221. X};
  222. Xtypedef struct amq_mount_tree amq_mount_tree;
  223. Xbool_t xdr_amq_mount_tree();
  224. X
  225. X
  226. Xtypedef amq_mount_tree *amq_mount_tree_p;
  227. Xbool_t xdr_amq_mount_tree_p();
  228. X
  229. X
  230. Xstruct amq_mount_info {
  231. X    amq_string mi_type;
  232. X    amq_string mi_mountpt;
  233. X    amq_string mi_mountinfo;
  234. X    amq_string mi_fserver;
  235. X    int mi_error;
  236. X    int mi_refc;
  237. X    int mi_up;
  238. X};
  239. Xtypedef struct amq_mount_info amq_mount_info;
  240. Xbool_t xdr_amq_mount_info();
  241. X
  242. X
  243. Xtypedef struct {
  244. X    u_int amq_mount_info_list_len;
  245. X    amq_mount_info *amq_mount_info_list_val;
  246. X} amq_mount_info_list;
  247. Xbool_t xdr_amq_mount_info_list();
  248. X
  249. X
  250. Xtypedef struct {
  251. X    u_int amq_mount_tree_list_len;
  252. X    amq_mount_tree_p *amq_mount_tree_list_val;
  253. X} amq_mount_tree_list;
  254. Xbool_t xdr_amq_mount_tree_list();
  255. X
  256. X
  257. Xstruct amq_mount_stats {
  258. X    int as_drops;
  259. X    int as_stale;
  260. X    int as_mok;
  261. X    int as_merr;
  262. X    int as_uerr;
  263. X};
  264. Xtypedef struct amq_mount_stats amq_mount_stats;
  265. Xbool_t xdr_amq_mount_stats();
  266. X
  267. X
  268. Xenum amq_opt {
  269. X    AMOPT_DEBUG = 0,
  270. X    AMOPT_LOGFILE = 1,
  271. X    AMOPT_XLOG = 2,
  272. X    AMOPT_FLUSHMAPC = 3
  273. X};
  274. Xtypedef enum amq_opt amq_opt;
  275. Xbool_t xdr_amq_opt();
  276. X
  277. X
  278. Xstruct amq_setopt {
  279. X    amq_opt as_opt;
  280. X    amq_string as_str;
  281. X};
  282. Xtypedef struct amq_setopt amq_setopt;
  283. Xbool_t xdr_amq_setopt();
  284. X
  285. X
  286. X#define AMQ_PROGRAM ((u_long)300019)
  287. X#define AMQ_VERSION ((u_long)1)
  288. X#define AMQPROC_NULL ((u_long)0)
  289. Xextern voidp amqproc_null_1();
  290. X#define AMQPROC_MNTTREE ((u_long)1)
  291. Xextern amq_mount_tree_p *amqproc_mnttree_1();
  292. X#define AMQPROC_UMNT ((u_long)2)
  293. Xextern voidp amqproc_umnt_1();
  294. X#define AMQPROC_STATS ((u_long)3)
  295. Xextern amq_mount_stats *amqproc_stats_1();
  296. X#define AMQPROC_EXPORT ((u_long)4)
  297. Xextern amq_mount_tree_list *amqproc_export_1();
  298. X#define AMQPROC_SETOPT ((u_long)5)
  299. Xextern int *amqproc_setopt_1();
  300. X#define AMQPROC_GETMNTFS ((u_long)6)
  301. Xextern amq_mount_info_list *amqproc_getmntfs_1();
  302. X
  303. END_OF_FILE
  304. if test 3382 -ne `wc -c <'amq.h'`; then
  305.     echo shar: \"'amq.h'\" unpacked with wrong size!
  306. fi
  307. # end of 'amq.h'
  308. fi
  309. if test -f 'amq_clnt.c' -a "${1}" != "-c" ; then 
  310.   echo shar: Will not clobber existing file \"'amq_clnt.c'\"
  311. else
  312. echo shar: Extracting \"'amq_clnt.c'\" \(3319 characters\)
  313. sed "s/^X//" >'amq_clnt.c' <<'END_OF_FILE'
  314. X/*
  315. X * $Id: amq_clnt.c,v 5.1.1.1 90/01/11 17:03:17 jsp Exp Locker: jsp $
  316. X *
  317. X * Copyright (c) 1990 Jan-Simon Pendry
  318. X * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
  319. X * Copyright (c) 1990 The Regents of the University of California.
  320. X * All rights reserved.
  321. X *
  322. X * This code is derived from software contributed to Berkeley by
  323. X * Jan-Simon Pendry at Imperial College, London.
  324. X *
  325. X * Redistribution and use in source and binary forms are permitted
  326. X * provided that the above copyright notice and this paragraph are
  327. X * duplicated in all such forms and that any documentation,
  328. X * advertising materials, and other materials related to such
  329. X * distribution and use acknowledge that the software was developed
  330. X * by Imperial College of Science, Technology and Medicine, London, UK.
  331. X * The names of the College and University may not be used to endorse
  332. X * or promote products derived from this software without specific
  333. X * prior written permission.
  334. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  335. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  336. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  337. X *
  338. X *    %W% (Berkeley) %G%
  339. X */
  340. X
  341. X#include "am.h"
  342. X#include "amq.h"
  343. X
  344. X/* Default timeout can be changed using clnt_control() */
  345. Xstatic struct timeval TIMEOUT = { 25, 0 };
  346. X
  347. Xvoidp
  348. Xamqproc_null_1(argp, clnt)
  349. X    voidp argp;
  350. X    CLIENT *clnt;
  351. X{
  352. X    static char res;
  353. X
  354. X    bzero((char *)&res, sizeof(res));
  355. X    if (clnt_call(clnt, AMQPROC_NULL, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
  356. X        return (NULL);
  357. X    }
  358. X    return ((voidp)&res);
  359. X}
  360. X
  361. X
  362. Xamq_mount_tree_p *
  363. Xamqproc_mnttree_1(argp, clnt)
  364. X    amq_string *argp;
  365. X    CLIENT *clnt;
  366. X{
  367. X    static amq_mount_tree_p res;
  368. X
  369. X    bzero((char *)&res, sizeof(res));
  370. X    if (clnt_call(clnt, AMQPROC_MNTTREE, xdr_amq_string, argp, xdr_amq_mount_tree_p, &res, TIMEOUT) != RPC_SUCCESS) {
  371. X        return (NULL);
  372. X    }
  373. X    return (&res);
  374. X}
  375. X
  376. X
  377. Xvoidp
  378. Xamqproc_umnt_1(argp, clnt)
  379. X    amq_string *argp;
  380. X    CLIENT *clnt;
  381. X{
  382. X    static char res;
  383. X
  384. X    bzero((char *)&res, sizeof(res));
  385. X    if (clnt_call(clnt, AMQPROC_UMNT, xdr_amq_string, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
  386. X        return (NULL);
  387. X    }
  388. X    return ((voidp)&res);
  389. X}
  390. X
  391. X
  392. Xamq_mount_stats *
  393. Xamqproc_stats_1(argp, clnt)
  394. X    voidp argp;
  395. X    CLIENT *clnt;
  396. X{
  397. X    static amq_mount_stats res;
  398. X
  399. X    bzero((char *)&res, sizeof(res));
  400. X    if (clnt_call(clnt, AMQPROC_STATS, xdr_void, argp, xdr_amq_mount_stats, &res, TIMEOUT) != RPC_SUCCESS) {
  401. X        return (NULL);
  402. X    }
  403. X    return (&res);
  404. X}
  405. X
  406. X
  407. Xamq_mount_tree_list *
  408. Xamqproc_export_1(argp, clnt)
  409. X    voidp argp;
  410. X    CLIENT *clnt;
  411. X{
  412. X    static amq_mount_tree_list res;
  413. X
  414. X    bzero((char *)&res, sizeof(res));
  415. X    if (clnt_call(clnt, AMQPROC_EXPORT, xdr_void, argp, xdr_amq_mount_tree_list, &res, TIMEOUT) != RPC_SUCCESS) {
  416. X        return (NULL);
  417. X    }
  418. X    return (&res);
  419. X}
  420. X
  421. Xint *
  422. Xamqproc_setopt_1(argp, clnt)
  423. X    amq_setopt *argp;
  424. X    CLIENT *clnt;
  425. X{
  426. X    static int res;
  427. X
  428. X    bzero((char *)&res, sizeof(res));
  429. X    if (clnt_call(clnt, AMQPROC_SETOPT, xdr_amq_setopt, argp, xdr_int, &res, TIMEOUT) != RPC_SUCCESS) {
  430. X        return (NULL);
  431. X    }
  432. X    return (&res);
  433. X}
  434. X
  435. X
  436. Xamq_mount_info_list *
  437. Xamqproc_getmntfs_1(argp, clnt)
  438. X    voidp argp;
  439. X    CLIENT *clnt;
  440. X{
  441. X    static amq_mount_info_list res;
  442. X
  443. X    bzero((char *)&res, sizeof(res));
  444. X    if (clnt_call(clnt, AMQPROC_GETMNTFS, xdr_void, argp, xdr_amq_mount_info_list, &res, TIMEOUT) != RPC_SUCCESS) {
  445. X        return (NULL);
  446. X    }
  447. X    return (&res);
  448. X}
  449. X
  450. END_OF_FILE
  451. if test 3319 -ne `wc -c <'amq_clnt.c'`; then
  452.     echo shar: \"'amq_clnt.c'\" unpacked with wrong size!
  453. fi
  454. # end of 'amq_clnt.c'
  455. fi
  456. if test -f 'doc/nh.sty' -a "${1}" != "-c" ; then 
  457.   echo shar: Will not clobber existing file \"'doc/nh.sty'\"
  458. else
  459. echo shar: Extracting \"'doc/nh.sty'\" \(3460 characters\)
  460. sed "s/^X//" >'doc/nh.sty' <<'END_OF_FILE'
  461. X% Change page size parameters for A4 paper on LaserWriter,
  462. X% allowing for headers and footers. Define some new macros for headers
  463. X% and footers too.
  464. X%
  465. X% MJW 9 Jan 1987
  466. X\oddsidemargin 16pt % MJW actually get 1/2 inch (=32pt) margin because
  467. X                   % of printer offset. was 1pt
  468. X\evensidemargin 16pt % was 1pt
  469. X\marginparwidth 30pt % these gain 53pt width
  470. X\topmargin 5pt      % gains 26pt height (MJW was 16pt)
  471. X\headheight 14pt      % gains 11pt height (MJW was 1pt)
  472. X\headsep 25pt         % gains 24pt height (MJW was 1pt)
  473. X%\footheight 12 pt   % cannot be changed as number must fit
  474. X\footskip 24pt       % gains 6pt height
  475. X\textheight % 528 + 26 + 11 + 24 + 6 + 55 for luck -16 +32 (heads: -10 -15)
  476. X%           650pt
  477. X%            666pt
  478. X        641pt
  479. X\textwidth % 360 + 53 + 47 for luck -15 +8
  480. X           453pt
  481. X%\pagestyle{myheadings}
  482. X%\markboth{LEFT}{RIGHT}
  483. X%left = even, right = odd for two-sided
  484. X% everything is right for one-sided
  485. X\def\evenheadline{}\def\oddheadline{}
  486. X\def\evenfootline{}\def\oddfootline{}
  487. X% Use these to set headers and footers for two-sided printing.
  488. X\def\setbothheaders#1#2{\def\evenheadline{#1}\def\oddheadline{#2}}
  489. X\def\setbothfooters#1#2{\def\evenfootline{#1}\def\oddfootline{#2}}
  490. X% Use these for one-sided printing.
  491. X\def\setheader#1{\def\oddheadline{#1}}\def\setfooter#1{\def\oddfootline{#1}}
  492. X% To set footer on first page of a chapter
  493. X\def\setchapterfoot#1{\def\chapterfoot{#1}}
  494. X\def\setchapterhead#1{\def\chapterhead{#1}}
  495. X% Initialise footers to the page number.
  496. X\setbothfooters{\hfil\thepage\hfil}{\hfil\thepage\hfil}
  497. X% Initialise chapter footer to page number, header empty.
  498. X\setchapterfoot{\hfil\thepage \hfil}
  499. X\setchapterhead{}
  500. X% My version of \chapter
  501. X\def\chapter{\clearpage      % Starts new page.
  502. X%  \if@twoside \cleardoublepage
  503. X%  \else\clearpage\fi        % Starts new page.
  504. X   \thispagestyle{chapterpage}     % Page style of chapter page is 'chapterpage'
  505. X   \global\@topnum\z@        % Prevents figures from going at top of page.
  506. X   \@afterindentfalse        % Suppresses indent in first paragraph.  Change
  507. X   \secdef\@chapter\@schapter}   % to \@afterindenttrue to have indent.
  508. X% Style for first page of a chapter
  509. X\def\ps@chapterpage{\let\@mkboth\markboth
  510. X\def\@evenhead{\chapterhead}\def\@oddhead{\chapterhead}
  511. X\def\@evenfoot{\chapterfoot}\def\@oddfoot{\chapterfoot}}
  512. X% Style for headers AND footers.
  513. X\if@twoside         % If two-sided printing.
  514. X\def\ps@footers{\let\@mkboth\markboth
  515. X\def\@evenhead{\evenheadline}\def\@oddhead{\oddheadline}
  516. X\def\@evenfoot{\evenfootline}\def\@oddfoot{\oddfootline}
  517. X% Chapter stuff
  518. X\def\chaptermark##1{\markboth{\uppercase{\ifnum \c@secnumdepth >\m@ne
  519. X \@chapapp\ \thechapter. \ \fi ##1}}{}}
  520. X\def\sectionmark##1{\markright{\uppercase{\ifnum \c@secnumdepth >\z@
  521. X   \thesection. \ \fi ##1}}}
  522. X}
  523. X\else               % If one-sided printing.
  524. X\def\ps@footers{\let\@mkboth\markboth
  525. X\def\@evenhead{\evenheadline}\def\@oddhead{\oddheadline}
  526. X\def\@evenfoot{\evenfootline}\def\@oddfoot{\oddfootline}
  527. X% Chapter stuff
  528. X%\def\chaptermark##1{\markright{\uppercase{\ifnum \c@secnumdepth >\m@ne
  529. X% \@chapapp\ \thechapter. \ \fi ##1}}}
  530. X\def\chaptermark##1{\markright{\sf {\ifnum \c@secnumdepth >\m@ne
  531. X \@chapapp\ \thechapter : \ \fi ##1}}}
  532. X}
  533. X\fi
  534. X
  535. X% Debugging stuff.
  536. X%\let\markbothorig\markboth
  537. X%\def\markboth#1#2{\typeout{---Markboth: \#1=#1, \#2=#2\newline}
  538. X%  \markbothorig {#1} {#2}}
  539. X%  
  540. X%\let\markrightorig\markright
  541. X%\def\markright#1{\typeout{---Markright: \#1=#1\newline}
  542. X%  \markrightorig {#1}}
  543. END_OF_FILE
  544. if test 3460 -ne `wc -c <'doc/nh.sty'`; then
  545.     echo shar: \"'doc/nh.sty'\" unpacked with wrong size!
  546. fi
  547. # end of 'doc/nh.sty'
  548. fi
  549. if test -f 'ifs_ops.c' -a "${1}" != "-c" ; then 
  550.   echo shar: Will not clobber existing file \"'ifs_ops.c'\"
  551. else
  552. echo shar: Extracting \"'ifs_ops.c'\" \(3361 characters\)
  553. sed "s/^X//" >'ifs_ops.c' <<'END_OF_FILE'
  554. X/*
  555. X * $Id: ifs_ops.c,v 5.1.1.1 89/11/28 17:46:37 jsp Exp Locker: jsp $
  556. X *
  557. X * Copyright (c) 1989 Jan-Simon Pendry
  558. X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  559. X * Copyright (c) 1989 The Regents of the University of California.
  560. X * All rights reserved.
  561. X *
  562. X * This code is derived from software contributed to Berkeley by
  563. X * Jan-Simon Pendry at Imperial College, London.
  564. X *
  565. X * Redistribution and use in source and binary forms are permitted
  566. X * provided that the above copyright notice and this paragraph are
  567. X * duplicated in all such forms and that any documentation,
  568. X * advertising materials, and other materials related to such
  569. X * distribution and use acknowledge that the software was developed
  570. X * by Imperial College of Science, Technology and Medicine, London, UK.
  571. X * The names of the College and University may not be used to endorse
  572. X * or promote products derived from this software without specific
  573. X * prior written permission.
  574. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  575. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  576. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  577. X *
  578. X *    %W% (Berkeley) %G%
  579. X */
  580. X
  581. X#include "am.h"
  582. X
  583. X#ifdef HAS_IFS
  584. X
  585. X/*
  586. X * Inheritance file system.
  587. X * This implements a filesystem restart.
  588. X *
  589. X * This is a *gross* hack - it knows far too
  590. X * much about the way other parts of the
  591. X * sytem work.  See restart.c too.
  592. X */
  593. Xstatic char not_a_filesystem[] = "Attempting to inherit not-a-filesystem";
  594. X/*
  595. X * This should never be called.
  596. X */
  597. Xstatic int ifs_match()
  598. X{
  599. X    plog(XLOG_FATAL, "ifs_match called!");
  600. X    return FALSE;
  601. X}
  602. X
  603. Xstatic int ifs_init(mf)
  604. Xmntfs *mf;
  605. X{
  606. X    mntfs *mf_link = (mntfs *) mf->mf_private;
  607. X    if (mf_link == 0) {
  608. X        plog(XLOG_FATAL, not_a_filesystem);
  609. X        return EINVAL;
  610. X    }
  611. X    /*
  612. X     * Fill in attribute fields
  613. X     */
  614. X    mf_link->mf_fattr.type = NFLNK;
  615. X    mf_link->mf_fattr.mode = NFSMODE_LNK | 0777;
  616. X    mf_link->mf_fattr.nlink = 1;
  617. X    mf_link->mf_fattr.size = MAXPATHLEN / 4;
  618. X    if (mf_link->mf_ops->fs_init)
  619. X        return (*mf_link->mf_ops->fs_init)(mf_link);
  620. X    return 0;
  621. X}
  622. X
  623. X/*ARGSUSED*/
  624. Xstatic int ifs_mount(mp)
  625. Xam_node *mp;
  626. X{
  627. X    mntfs *mf = mp->am_mnt;
  628. X
  629. X    /*
  630. X     * Take the linked mount point and
  631. X     * propogate.
  632. X     */
  633. X    mntfs *mf_link = (mntfs *) mf->mf_private;
  634. X    if (mf_link == 0) {
  635. X        plog(XLOG_FATAL, not_a_filesystem);
  636. X        return EINVAL;    /*XXX*/
  637. X    }
  638. X
  639. X    mf_link->mf_fo = mf->mf_fo;
  640. X    mf_link->mf_fattr.fileid = mf->mf_fattr.fileid;
  641. X
  642. X    /*
  643. X     * Discard the old map.
  644. X     * Don't call am_unmounted since this
  645. X     * node was never really mounted in the
  646. X     * first place.
  647. X     */
  648. X    mf->mf_private = 0;
  649. X    free_mntfs(mf);
  650. X    /*
  651. X     * Free the dangling reference
  652. X     * to the mount link.
  653. X     */
  654. X    free_mntfs(mf_link);
  655. X    /*
  656. X     * Get a hold of the other entry
  657. X     */
  658. X    mp->am_mnt = mf = mf_link;
  659. X    mf->mf_flags &= ~MFF_RESTART;
  660. X
  661. X    /* Say what happened */
  662. X    plog(XLOG_INFO, "restarting %s on %s", mf->mf_info, mf->mf_mount);
  663. X
  664. X    /*
  665. X     * XXX - must do the am_mounted call here
  666. X     */
  667. X    if (mf->mf_ops->fs_flags & FS_MBACKGROUND)
  668. X        am_mounted(mp);
  669. X
  670. X    new_ttl(mp);
  671. X
  672. X    return 0;
  673. X}
  674. X
  675. X/*ARGSUSED*/
  676. Xstatic int ifs_umount(mp)
  677. Xam_node *mp;
  678. X{
  679. X    /*
  680. X     * Always succeed
  681. X     */
  682. X    return 0;
  683. X}
  684. X
  685. X/*
  686. X * Ops structure
  687. X */
  688. Xam_ops ifs_ops = {
  689. X    "inherit",
  690. X    ifs_match,
  691. X    ifs_init,
  692. X    ifs_mount,
  693. X    ifs_umount,
  694. X    efs_lookuppn,
  695. X    efs_readdir,
  696. X    0, /* ifs_readlink */
  697. X    0, /* ifs_mounted */
  698. X    0, /* ifs_umounted */
  699. X    find_afs_srvr,
  700. X    FS_DISCARD,
  701. X    &afs_srvr_list
  702. X};
  703. X
  704. X#endif
  705. END_OF_FILE
  706. if test 3361 -ne `wc -c <'ifs_ops.c'`; then
  707.     echo shar: \"'ifs_ops.c'\" unpacked with wrong size!
  708. fi
  709. # end of 'ifs_ops.c'
  710. fi
  711. if test -f 'mount.x' -a "${1}" != "-c" ; then 
  712.   echo shar: Will not clobber existing file \"'mount.x'\"
  713. else
  714. echo shar: Extracting \"'mount.x'\" \(3121 characters\)
  715. sed "s/^X//" >'mount.x' <<'END_OF_FILE'
  716. X/* $Id: mount.x,v 5.1 89/11/17 18:20:52 jsp Exp Locker: jsp $ */
  717. X/* From: mount.x 1.4 88/02/08 Copyr 1987 Sun Micro */
  718. X
  719. X/*
  720. X * Protocol description for the mount program
  721. X */
  722. X
  723. X
  724. Xconst MNTPATHLEN = 1024;    /* maximum bytes in a pathname argument */
  725. Xconst MNTNAMLEN = 255;        /* maximum bytes in a name argument */
  726. Xconst FHSIZE = 32;        /* size in bytes of a file handle */
  727. X
  728. X/*
  729. X * The fhandle is the file handle that the server passes to the client.
  730. X * All file operations are done using the file handles to refer to a file
  731. X * or a directory. The file handle can contain whatever information the
  732. X * server needs to distinguish an individual file.
  733. X */
  734. Xtypedef opaque fhandle[FHSIZE];    
  735. X
  736. X/*
  737. X * If a status of zero is returned, the call completed successfully, and 
  738. X * a file handle for the directory follows. A non-zero status indicates
  739. X * some sort of error. The status corresponds with UNIX error numbers.
  740. X */
  741. Xunion fhstatus switch (unsigned fhs_status) {
  742. Xcase 0:
  743. X    fhandle fhs_fhandle;
  744. Xdefault:
  745. X    void;
  746. X};
  747. X
  748. X/*
  749. X * The type dirpath is the pathname of a directory
  750. X */
  751. Xtypedef string dirpath<MNTPATHLEN>;
  752. X
  753. X/*
  754. X * The type name is used for arbitrary names (hostnames, groupnames)
  755. X */
  756. Xtypedef string name<MNTNAMLEN>;
  757. X
  758. X/*
  759. X * A list of who has what mounted
  760. X */
  761. Xtypedef struct mountbody *mountlist;
  762. Xstruct mountbody {
  763. X    name ml_hostname;
  764. X    dirpath ml_directory;
  765. X    mountlist ml_next;
  766. X};
  767. X
  768. X/*
  769. X * A list of netgroups
  770. X */
  771. Xtypedef struct groupnode *groups;
  772. Xstruct groupnode {
  773. X    name gr_name;
  774. X    groups gr_next;
  775. X};
  776. X
  777. X/*
  778. X * A list of what is exported and to whom
  779. X */
  780. Xtypedef struct exportnode *exports;
  781. Xstruct exportnode {
  782. X    dirpath ex_dir;
  783. X    groups ex_groups;
  784. X    exports ex_next;
  785. X};
  786. X
  787. Xprogram MOUNTPROG {
  788. X    /*
  789. X     * Version one of the mount protocol communicates with version two
  790. X     * of the NFS protocol. The only connecting point is the fhandle 
  791. X     * structure, which is the same for both protocols.
  792. X     */
  793. X    version MOUNTVERS {
  794. X        /*
  795. X         * Does no work. It is made available in all RPC services
  796. X         * to allow server reponse testing and timing
  797. X         */
  798. X        void
  799. X        MOUNTPROC_NULL(void) = 0;
  800. X
  801. X        /*    
  802. X         * If fhs_status is 0, then fhs_fhandle contains the
  803. X          * file handle for the directory. This file handle may
  804. X         * be used in the NFS protocol. This procedure also adds
  805. X         * a new entry to the mount list for this client mounting
  806. X         * the directory.
  807. X         * Unix authentication required.
  808. X         */
  809. X        fhstatus 
  810. X        MOUNTPROC_MNT(dirpath) = 1;
  811. X
  812. X        /*
  813. X         * Returns the list of remotely mounted filesystems. The 
  814. X         * mountlist contains one entry for each hostname and 
  815. X         * directory pair.
  816. X         */
  817. X        mountlist
  818. X        MOUNTPROC_DUMP(void) = 2;
  819. X
  820. X        /*
  821. X         * Removes the mount list entry for the directory
  822. X         * Unix authentication required.
  823. X         */
  824. X        void
  825. X        MOUNTPROC_UMNT(dirpath) = 3;
  826. X
  827. X        /*
  828. X         * Removes all of the mount list entries for this client
  829. X         * Unix authentication required.
  830. X         */
  831. X        void
  832. X        MOUNTPROC_UMNTALL(void) = 4;
  833. X
  834. X        /*
  835. X         * Returns a list of all the exported filesystems, and which
  836. X         * machines are allowed to import it.
  837. X         */
  838. X        exports
  839. X        MOUNTPROC_EXPORT(void)  = 5;
  840. X    
  841. X        /*
  842. X         * Identical to MOUNTPROC_EXPORT above
  843. X         */
  844. X        exports
  845. X        MOUNTPROC_EXPORTALL(void) = 6;
  846. X    } = 1;
  847. X} = 100005;
  848. END_OF_FILE
  849. if test 3121 -ne `wc -c <'mount.x'`; then
  850.     echo shar: \"'mount.x'\" unpacked with wrong size!
  851. fi
  852. # end of 'mount.x'
  853. fi
  854. if test -f 'mount_xdr.c' -a "${1}" != "-c" ; then 
  855.   echo shar: Will not clobber existing file \"'mount_xdr.c'\"
  856. else
  857. echo shar: Extracting \"'mount_xdr.c'\" \(3132 characters\)
  858. sed "s/^X//" >'mount_xdr.c' <<'END_OF_FILE'
  859. X/*
  860. X * $Id: mount_xdr.c,v 5.1 89/11/17 18:21:00 jsp Exp Locker: jsp $
  861. X *
  862. X * Copyright (c) 1989 Jan-Simon Pendry
  863. X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  864. X * Copyright (c) 1989 The Regents of the University of California.
  865. X * All rights reserved.
  866. X *
  867. X * This code is derived from software contributed to Berkeley by
  868. X * Jan-Simon Pendry at Imperial College, London.
  869. X *
  870. X * Redistribution and use in source and binary forms are permitted
  871. X * provided that the above copyright notice and this paragraph are
  872. X * duplicated in all such forms and that any documentation,
  873. X * advertising materials, and other materials related to such
  874. X * distribution and use acknowledge that the software was developed
  875. X * by Imperial College of Science, Technology and Medicine, London, UK.
  876. X * The names of the College and University may not be used to endorse
  877. X * or promote products derived from this software without specific
  878. X * prior written permission.
  879. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  880. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  881. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  882. X *
  883. X *    %W% (Berkeley) %G%
  884. X */
  885. X
  886. X#include "am.h"
  887. X#include "mount.h"
  888. X
  889. X
  890. Xbool_t
  891. Xxdr_fhandle(xdrs, objp)
  892. X    XDR *xdrs;
  893. X    fhandle objp;
  894. X{
  895. X    if (!xdr_opaque(xdrs, objp, FHSIZE)) {
  896. X        return (FALSE);
  897. X    }
  898. X    return (TRUE);
  899. X}
  900. X
  901. X
  902. X
  903. X
  904. Xbool_t
  905. Xxdr_fhstatus(xdrs, objp)
  906. X    XDR *xdrs;
  907. X    fhstatus *objp;
  908. X{
  909. X    if (!xdr_u_int(xdrs, &objp->fhs_status)) {
  910. X        return (FALSE);
  911. X    }
  912. X    switch (objp->fhs_status) {
  913. X    case 0:
  914. X        if (!xdr_fhandle(xdrs, objp->fhstatus_u.fhs_fhandle)) {
  915. X            return (FALSE);
  916. X        }
  917. X        break;
  918. X    }
  919. X    return (TRUE);
  920. X}
  921. X
  922. X
  923. X
  924. X
  925. Xbool_t
  926. Xxdr_dirpath(xdrs, objp)
  927. X    XDR *xdrs;
  928. X    dirpath *objp;
  929. X{
  930. X    if (!xdr_string(xdrs, objp, MNTPATHLEN)) {
  931. X        return (FALSE);
  932. X    }
  933. X    return (TRUE);
  934. X}
  935. X
  936. X
  937. X
  938. X
  939. Xbool_t
  940. Xxdr_name(xdrs, objp)
  941. X    XDR *xdrs;
  942. X    name *objp;
  943. X{
  944. X    if (!xdr_string(xdrs, objp, MNTNAMLEN)) {
  945. X        return (FALSE);
  946. X    }
  947. X    return (TRUE);
  948. X}
  949. X
  950. X
  951. X
  952. X
  953. Xbool_t
  954. Xxdr_mountlist(xdrs, objp)
  955. X    XDR *xdrs;
  956. X    mountlist *objp;
  957. X{
  958. X    if (!xdr_name(xdrs, &objp->ml_hostname)) {
  959. X        return (FALSE);
  960. X    }
  961. X    if (!xdr_dirpath(xdrs, &objp->ml_directory)) {
  962. X        return (FALSE);
  963. X    }
  964. X    if (!xdr_pointer(xdrs, (char **)&objp->ml_next, sizeof(mountlist), xdr_mountlist)) {
  965. X        return (FALSE);
  966. X    }
  967. X    return (TRUE);
  968. X}
  969. X
  970. X
  971. X
  972. X
  973. Xbool_t
  974. Xxdr_groups(xdrs, objp)
  975. X    XDR *xdrs;
  976. X    groups *objp;
  977. X{
  978. X    if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct groupnode), xdr_groupnode)) {
  979. X        return (FALSE);
  980. X    }
  981. X    return (TRUE);
  982. X}
  983. X
  984. X
  985. X
  986. X
  987. Xbool_t
  988. Xxdr_groupnode(xdrs, objp)
  989. X    XDR *xdrs;
  990. X    groupnode *objp;
  991. X{
  992. X    if (!xdr_name(xdrs, &objp->gr_name)) {
  993. X        return (FALSE);
  994. X    }
  995. X    if (!xdr_groups(xdrs, &objp->gr_next)) {
  996. X        return (FALSE);
  997. X    }
  998. X    return (TRUE);
  999. X}
  1000. X
  1001. X
  1002. X
  1003. X
  1004. Xbool_t
  1005. Xxdr_exports(xdrs, objp)
  1006. X    XDR *xdrs;
  1007. X    exports *objp;
  1008. X{
  1009. X    if (!xdr_pointer(xdrs, (char **)objp, sizeof(struct exportnode), xdr_exportnode)) {
  1010. X        return (FALSE);
  1011. X    }
  1012. X    return (TRUE);
  1013. X}
  1014. X
  1015. X
  1016. X
  1017. X
  1018. Xbool_t
  1019. Xxdr_exportnode(xdrs, objp)
  1020. X    XDR *xdrs;
  1021. X    exportnode *objp;
  1022. X{
  1023. X    if (!xdr_dirpath(xdrs, &objp->ex_dir)) {
  1024. X        return (FALSE);
  1025. X    }
  1026. X    if (!xdr_groups(xdrs, &objp->ex_groups)) {
  1027. X        return (FALSE);
  1028. X    }
  1029. X    if (!xdr_exports(xdrs, &objp->ex_next)) {
  1030. X        return (FALSE);
  1031. X    }
  1032. X    return (TRUE);
  1033. X}
  1034. X
  1035. X
  1036. END_OF_FILE
  1037. if test 3132 -ne `wc -c <'mount_xdr.c'`; then
  1038.     echo shar: \"'mount_xdr.c'\" unpacked with wrong size!
  1039. fi
  1040. # end of 'mount_xdr.c'
  1041. fi
  1042. if test -f 'os-bsd44.h' -a "${1}" != "-c" ; then 
  1043.   echo shar: Will not clobber existing file \"'os-bsd44.h'\"
  1044. else
  1045. echo shar: Extracting \"'os-bsd44.h'\" \(3568 characters\)
  1046. sed "s/^X//" >'os-bsd44.h' <<'END_OF_FILE'
  1047. X/* $Id: os-bsd44.h,v 5.1.1.3 90/01/11 17:14:58 jsp Exp Locker: jsp $ */
  1048. X
  1049. X/*
  1050. X * 4.4 BSD definitions for Amd (automounter)
  1051. X *
  1052. X * Copyright (c) 1990 Jan-Simon Pendry
  1053. X * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
  1054. X * Copyright (c) 1990 The Regents of the University of California.
  1055. X * All rights reserved.
  1056. X *
  1057. X * This code is derived from software contributed to Berkeley by
  1058. X * Jan-Simon Pendry at Imperial College, London.
  1059. X *
  1060. X * Redistribution and use in source and binary forms are permitted
  1061. X * provided that the above copyright notice and this paragraph are
  1062. X * duplicated in all such forms and that any documentation,
  1063. X * advertising materials, and other materials related to such
  1064. X * distribution and use acknowledge that the software was developed
  1065. X * by Imperial College of Science, Technology and Medicine, London, UK.
  1066. X * The names of the College and University may not be used to endorse
  1067. X * or promote products derived from this software without specific
  1068. X * prior written permission.
  1069. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1070. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1071. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1072. X *
  1073. X *    %W% (Berkeley) %G%
  1074. X */
  1075. X
  1076. X/*
  1077. X * Does the compiler grok void *
  1078. X */
  1079. X#define    VOIDP
  1080. X
  1081. X/*
  1082. X * Which version of the Sun RPC library we are using
  1083. X * This is the implementation release number, not
  1084. X * the protocol revision number.
  1085. X */
  1086. X#define    RPC_3
  1087. X
  1088. X/*
  1089. X * Which version of the NFS interface are we using.
  1090. X * This is the implementation release number, not
  1091. X * the protocol revision number.
  1092. X */
  1093. X#define    NFS_44
  1094. X
  1095. X/*
  1096. X * Does this OS have NDBM support?
  1097. X */
  1098. X#define OS_HAS_NDBM
  1099. X
  1100. X/*
  1101. X * The mount table is obtained from the kernel
  1102. X */
  1103. X#undef    UPDATE_MTAB
  1104. X
  1105. X/*
  1106. X * No mntent info on 4.4 BSD
  1107. X */
  1108. X#undef    MNTENT_HDR
  1109. X
  1110. X/*
  1111. X * Name of filesystem types
  1112. X */
  1113. X#define    MOUNT_TYPE_NFS    MOUNT_NFS
  1114. X#define    MOUNT_TYPE_UFS    MOUNT_UFS
  1115. X#undef MTAB_TYPE_UFS
  1116. X#define    MTAB_TYPE_UFS    "ufs"
  1117. X#define    MTAB_TYPE_MFS    "mfs"
  1118. X
  1119. X/*
  1120. X * How to unmount filesystems
  1121. X */
  1122. X#undef UNMOUNT_TRAP
  1123. X#undef    NEED_UMOUNT_FS
  1124. X#define    NEED_UMOUNT_BSD
  1125. X
  1126. X/*
  1127. X * Byte ordering
  1128. X */
  1129. X#ifndef BYTE_ORDER
  1130. X#include <machine/endian.h>
  1131. X#endif /* BYTE_ORDER */
  1132. X
  1133. X#undef ARCH_ENDIAN
  1134. X#if BYTE_ORDER == LITTLE_ENDIAN
  1135. X#define ARCH_ENDIAN "little"
  1136. X#else
  1137. X#if BYTE_ORDER == BIG_ENDIAN
  1138. X#define ARCH_ENDIAN "big"
  1139. X#else
  1140. XXXX - Probably no hope of running Amd on this machine!
  1141. X#endif /* BIG */
  1142. X#endif /* LITTLE */
  1143. X
  1144. X/*
  1145. X * Miscellaneous 4.4 BSD bits
  1146. X */
  1147. X#define MISC_RPC
  1148. X#define    NEED_MNTOPT_PARSER
  1149. X#define    SHORT_MOUNT_NAME
  1150. X
  1151. X#define    MNTMAXSTR       128
  1152. X
  1153. X#define    MNTTYPE_UFS    "ufs"        /* Un*x file system */
  1154. X#define    MNTTYPE_NFS    "nfs"        /* network file system */
  1155. X#define    MNTTYPE_MFS    "mfs"        /* memory file system */
  1156. X#define    MNTTYPE_IGNORE    "ignore"    /* No type specified, ignore this entry */
  1157. X
  1158. X#define    M_SYNC    M_SYNCHRONOUS
  1159. X
  1160. X#define    MNTOPT_SOFT    "soft"        /* soft mount */
  1161. X#define    MNTOPT_INTR    "intr"        /* interrupts allowed */
  1162. X
  1163. Xstruct mntent {
  1164. X    char    *mnt_fsname;    /* name of mounted file system */
  1165. X    char    *mnt_dir;    /* file system path prefix */
  1166. X    char    *mnt_type;    /* MNTTYPE_* */
  1167. X    char    *mnt_opts;    /* MNTOPT* */
  1168. X    int    mnt_freq;    /* dump frequency, in days */
  1169. X    int    mnt_passno;    /* pass number on parallel fsck */
  1170. X};
  1171. X
  1172. X/*
  1173. X * Type of a file handle
  1174. X */
  1175. X#undef NFS_FH_TYPE
  1176. X#define    NFS_FH_TYPE    nfsv2fh_t *
  1177. X
  1178. X/*
  1179. X * How to get a mount list
  1180. X */
  1181. X#undef    READ_MTAB_FROM_FILE
  1182. X#define    READ_MTAB_BSD_STYLE
  1183. X
  1184. X/*
  1185. X * The data for the mount syscall needs the path in addition to the
  1186. X * host name since that is the only source of information about the
  1187. X * mounted filesystem.
  1188. X */
  1189. X#define    NFS_ARGS_NEEDS_PATH
  1190. END_OF_FILE
  1191. if test 3568 -ne `wc -c <'os-bsd44.h'`; then
  1192.     echo shar: \"'os-bsd44.h'\" unpacked with wrong size!
  1193. fi
  1194. # end of 'os-bsd44.h'
  1195. fi
  1196. if test -f 'os-u2_2.h' -a "${1}" != "-c" ; then 
  1197.   echo shar: Will not clobber existing file \"'os-u2_2.h'\"
  1198. else
  1199. echo shar: Extracting \"'os-u2_2.h'\" \(3606 characters\)
  1200. sed "s/^X//" >'os-u2_2.h' <<'END_OF_FILE'
  1201. X/* $Id: os-u2_2.h,v 5.1.1.1 90/01/11 17:16:29 jsp Exp Locker: jsp $ */
  1202. X
  1203. X/*
  1204. X * Ultrix 2.2 definitions for Amd (automounter)
  1205. X *
  1206. X * Copyright (c) 1990 Jan-Simon Pendry
  1207. X * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
  1208. X * Copyright (c) 1990 The Regents of the University of California.
  1209. X * All rights reserved.
  1210. X *
  1211. X * This code is derived from software contributed to Berkeley by
  1212. X * Jan-Simon Pendry at Imperial College, London.
  1213. X *
  1214. X * Redistribution and use in source and binary forms are permitted
  1215. X * provided that the above copyright notice and this paragraph are
  1216. X * duplicated in all such forms and that any documentation,
  1217. X * advertising materials, and other materials related to such
  1218. X * distribution and use acknowledge that the software was developed
  1219. X * by Imperial College of Science, Technology and Medicine, London, UK.
  1220. X * The names of the College and University may not be used to endorse
  1221. X * or promote products derived from this software without specific
  1222. X * prior written permission.
  1223. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1224. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1225. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1226. X *
  1227. X *    %W% (Berkeley) %G%
  1228. X */
  1229. X
  1230. X/*
  1231. X * Does the compiler grok void *
  1232. X */
  1233. X#undef    VOIDP
  1234. X
  1235. X/*
  1236. X * Which version of the Sun RPC library we are using
  1237. X * This is the implementation release number, not
  1238. X * the protocol revision number.
  1239. X */
  1240. X#define    RPC_3
  1241. X
  1242. X/*
  1243. X * Which version of the NFS interface are we using.
  1244. X * This is the implementation release number, not
  1245. X * the protocol revision number.
  1246. X */
  1247. X#define    NFS_3
  1248. X
  1249. X/*
  1250. X * Byte ordering
  1251. X */
  1252. X#undef    ARCH_ENDIAN
  1253. X#if defined(vax)
  1254. X#define    ARCH_ENDIAN "little"
  1255. X#endif
  1256. X
  1257. X/*
  1258. X * The mount table is obtained from the kernel
  1259. X */
  1260. X#undef    UPDATE_MTAB
  1261. X
  1262. X/*
  1263. X * No mntent info on Ultrix
  1264. X  */
  1265. X#undef    MNTENT_HDR
  1266. X
  1267. X/*
  1268. X * No support for syslog()
  1269. X */
  1270. X#undef    HAS_SYSLOG
  1271. X
  1272. X/*
  1273. X * No support for ndbm
  1274. X */
  1275. X#undef    HAS_NDBM_MAPS
  1276. X
  1277. X/*
  1278. X * Name of filesystem types
  1279. X */
  1280. X#define    MOUNT_TYPE_NFS    GT_NFS
  1281. X#define    MOUNT_TYPE_UFS    GT_ULTRIX
  1282. X#undef    MTAB_TYPE_UFS
  1283. X#define    MTAB_TYPE_UFS    "ufs"
  1284. X
  1285. X/*
  1286. X * Name of mount & unmount system calls
  1287. X */
  1288. X#undef    MOUNT_TRAP
  1289. X#define    MOUNT_TRAP(type, mnt, flag, mnt_data) \
  1290. X    mount(mnt->mnt_fsname, mnt->mnt_dir, flag, type, mnt_data)
  1291. X#undef    UNMOUNT_TRAP
  1292. X#define    UNMOUNT_TRAP(mnt)    umount(mnt->mnt_passno)
  1293. X
  1294. X/*
  1295. X * Miscellaneous Ultrix bits
  1296. X */
  1297. X#define    M_RDONLY    M_RONLY
  1298. X
  1299. X#ifndef MNTMAXSTR
  1300. X#define    MNTMAXSTR       128
  1301. X#endif
  1302. X
  1303. X#define    MNTTYPE_UFS    "ufs"        /* Un*x file system */
  1304. X#define    MNTTYPE_NFS    "nfs"        /* network file system */
  1305. X#define    MNTTYPE_IGNORE    "ignore"    /* No type specified, ignore this entry */
  1306. X
  1307. X#define    MNTOPT_RO    "ro"        /* read only */
  1308. X#define    MNTOPT_RW    "rw"        /* read/write */
  1309. X#define    MNTOPT_QUOTA    "quota"        /* quotas */
  1310. X#define    MNTOPT_NOQUOTA    "noquota"    /* no quotas */
  1311. X#define    MNTOPT_HARD    "hard"        /* hard mount */
  1312. X#define    MNTOPT_SOFT    "soft"        /* soft mount */
  1313. X#define    MNTOPT_INTR    "intr"        /* interrupts allowed */
  1314. X
  1315. X#define    MNTOPT_NOSUID    "nosuid"    /* no set uid allowed */
  1316. X
  1317. Xstruct mntent {
  1318. X    char    *mnt_fsname;    /* name of mounted file system */
  1319. X    char    *mnt_dir;    /* file system path prefix */
  1320. X    char    *mnt_type;    /* MNTTYPE_* */
  1321. X    char    *mnt_opts;    /* MNTOPT* */
  1322. X    int    mnt_freq;    /* dump frequency, in days */
  1323. X    int    mnt_passno;    /* pass number on parallel fsck */
  1324. X};
  1325. X#define    MOUNTED        "/etc/mtab"
  1326. X
  1327. X#define    NFS_HDR    "u2_2-nfs.h"
  1328. X#define    UFS_HDR    "u2_2-nfs.h"
  1329. X
  1330. X#define    MISC_RPC
  1331. X
  1332. X#define    nfs_args    nfs_gfs_mount
  1333. X#define    ULTRIX_HACK    /* Should be handled better than this !! */
  1334. X#define    NEED_MNTOPT_PARSER
  1335. X
  1336. X/*
  1337. X * How to get a mount list
  1338. X */
  1339. X#undef    READ_MTAB_FROM_FILE
  1340. X#define    READ_MTAB_ULTRIX_STYLE
  1341. END_OF_FILE
  1342. if test 3606 -ne `wc -c <'os-u2_2.h'`; then
  1343.     echo shar: \"'os-u2_2.h'\" unpacked with wrong size!
  1344. fi
  1345. # end of 'os-u2_2.h'
  1346. fi
  1347. if test -f 'os-u3_0.h' -a "${1}" != "-c" ; then 
  1348.   echo shar: Will not clobber existing file \"'os-u3_0.h'\"
  1349. else
  1350. echo shar: Extracting \"'os-u3_0.h'\" \(3536 characters\)
  1351. sed "s/^X//" >'os-u3_0.h' <<'END_OF_FILE'
  1352. X/* $Id: os-u3_0.h,v 5.1 89/11/17 18:23:18 jsp Exp Locker: jsp $ */
  1353. X
  1354. X/*
  1355. X * Ultrix 3.0 definitions for Amd (automounter)
  1356. X *
  1357. X * Copyright (c) 1989 Jan-Simon Pendry
  1358. X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  1359. X * Copyright (c) 1989 The Regents of the University of California.
  1360. X * All rights reserved.
  1361. X *
  1362. X * This code is derived from software contributed to Berkeley by
  1363. X * Jan-Simon Pendry at Imperial College, London.
  1364. X *
  1365. X * Redistribution and use in source and binary forms are permitted
  1366. X * provided that the above copyright notice and this paragraph are
  1367. X * duplicated in all such forms and that any documentation,
  1368. X * advertising materials, and other materials related to such
  1369. X * distribution and use acknowledge that the software was developed
  1370. X * by Imperial College of Science, Technology and Medicine, London, UK.
  1371. X * The names of the College and University may not be used to endorse
  1372. X * or promote products derived from this software without specific
  1373. X * prior written permission.
  1374. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1375. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1376. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1377. X *
  1378. X *    %W% (Berkeley) %G%
  1379. X */
  1380. X
  1381. X/*
  1382. X * Does the compiler grok void *
  1383. X */
  1384. X#undef    VOIDP
  1385. X
  1386. X/*
  1387. X * Which version of the Sun RPC library we are using
  1388. X * This is the implementation release number, not
  1389. X * the protocol revision number.
  1390. X */
  1391. X#define    RPC_3
  1392. X
  1393. X/*
  1394. X * Which version of the NFS interface are we using.
  1395. X * This is the implementation release number, not
  1396. X * the protocol revision number.
  1397. X */
  1398. X#define    NFS_3
  1399. X
  1400. X/*
  1401. X * Byte ordering
  1402. X */
  1403. X#undef ARCH_ENDIAN
  1404. X#if defined(vax) || defined(mips)
  1405. X#define    ARCH_ENDIAN "little"
  1406. X#endif
  1407. X
  1408. X/*
  1409. X * The mount table is obtained from the kernel
  1410. X */
  1411. X#undef    UPDATE_MTAB
  1412. X
  1413. X/*
  1414. X * No mntent info on Ultrix
  1415. X  */
  1416. X#undef    MNTENT_HDR
  1417. X
  1418. X/*
  1419. X * No support for syslog()
  1420. X */
  1421. X#undef    HAS_SYSLOG
  1422. X
  1423. X/*
  1424. X * Name of filesystem types
  1425. X */
  1426. X#define    MOUNT_TYPE_NFS    GT_NFS
  1427. X#define    MOUNT_TYPE_UFS    GT_ULTRIX
  1428. X#undef    MTAB_TYPE_UFS
  1429. X#define    MTAB_TYPE_UFS    "ufs"
  1430. X
  1431. X/*
  1432. X * Name of mount & unmount system calls
  1433. X */
  1434. X#undef    MOUNT_TRAP
  1435. X#define    MOUNT_TRAP(type, mnt, flag, mnt_data) \
  1436. X    mount(mnt->mnt_fsname, mnt->mnt_dir, flag, type, mnt_data)
  1437. X#undef    UNMOUNT_TRAP
  1438. X#define    UNMOUNT_TRAP(mnt)    umount(mnt->mnt_passno)
  1439. X
  1440. X/*
  1441. X * Miscellaneous Ultrix bits
  1442. X */
  1443. X#define    M_RDONLY    M_RONLY
  1444. X
  1445. X#define    MNTMAXSTR    128
  1446. X
  1447. X#define    MNTTYPE_UFS    "ufs"        /* Un*x file system */
  1448. X#define    MNTTYPE_NFS    "nfs"        /* network file system */
  1449. X#define    MNTTYPE_IGNORE    "ignore"    /* No type specified, ignore this entry */
  1450. X
  1451. X#define    MNTOPT_RO    "ro"        /* read only */
  1452. X#define    MNTOPT_RW    "rw"        /* read/write */
  1453. X#define    MNTOPT_QUOTA    "quota"        /* quotas */
  1454. X#define    MNTOPT_NOQUOTA    "noquota"    /* no quotas */
  1455. X#define    MNTOPT_HARD    "hard"        /* hard mount */
  1456. X#define    MNTOPT_SOFT    "soft"        /* soft mount */
  1457. X#define    MNTOPT_INTR    "intr"        /* interrupts allowed */
  1458. X
  1459. X#define    MNTOPT_NOSUID    "nosuid"    /* no set uid allowed */
  1460. X
  1461. Xstruct mntent {
  1462. X    char    *mnt_fsname;    /* name of mounted file system */
  1463. X    char    *mnt_dir;    /* file system path prefix */
  1464. X    char    *mnt_type;    /* MNTTYPE_* */
  1465. X    char    *mnt_opts;    /* MNTOPT* */
  1466. X    int    mnt_freq;    /* dump frequency, in days */
  1467. X    int    mnt_passno;    /* pass number on parallel fsck */
  1468. X};
  1469. X#define    MOUNTED        "/etc/mtab"
  1470. X
  1471. X#define    NFS_HDR    "u2_2-nfs.h"
  1472. X#define    UFS_HDR    "u2_2-nfs.h"
  1473. X
  1474. X#define    MISC_RPC
  1475. X
  1476. X#define    nfs_args    nfs_gfs_mount
  1477. X#define    ULTRIX_HACK    /* Should be handled better than this !! */
  1478. X#define    NEED_MNTOPT_PARSER
  1479. X
  1480. X/*
  1481. X * How to get a mount list
  1482. X */
  1483. X#undef    READ_MTAB_FROM_FILE
  1484. X#define    READ_MTAB_ULTRIX_STYLE
  1485. END_OF_FILE
  1486. if test 3536 -ne `wc -c <'os-u3_0.h'`; then
  1487.     echo shar: \"'os-u3_0.h'\" unpacked with wrong size!
  1488. fi
  1489. # end of 'os-u3_0.h'
  1490. fi
  1491. if test -f 'pfs_ops.c' -a "${1}" != "-c" ; then 
  1492.   echo shar: Will not clobber existing file \"'pfs_ops.c'\"
  1493. else
  1494. echo shar: Extracting \"'pfs_ops.c'\" \(3296 characters\)
  1495. sed "s/^X//" >'pfs_ops.c' <<'END_OF_FILE'
  1496. X/*
  1497. X * $Id: pfs_ops.c,v 5.1.1.1 90/01/11 17:17:20 jsp Exp Locker: jsp $
  1498. X *
  1499. X * Copyright (c) 1989 Jan-Simon Pendry
  1500. X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  1501. X * Copyright (c) 1989 The Regents of the University of California.
  1502. X * All rights reserved.
  1503. X *
  1504. X * This code is derived from software contributed to Berkeley by
  1505. X * Jan-Simon Pendry at Imperial College, London.
  1506. X *
  1507. X * Redistribution and use in source and binary forms are permitted
  1508. X * provided that the above copyright notice and this paragraph are
  1509. X * duplicated in all such forms and that any documentation,
  1510. X * advertising materials, and other materials related to such
  1511. X * distribution and use acknowledge that the software was developed
  1512. X * by Imperial College of Science, Technology and Medicine, London, UK.
  1513. X * The names of the College and University may not be used to endorse
  1514. X * or promote products derived from this software without specific
  1515. X * prior written permission.
  1516. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1517. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1518. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1519. X *
  1520. X *    %W% (Berkeley) %G%
  1521. X */
  1522. X
  1523. X#include "am.h"
  1524. X
  1525. X#ifdef HAS_PFS
  1526. X
  1527. X/*
  1528. X * Program file system
  1529. X */
  1530. X
  1531. X/*
  1532. X * Execute needs a mount and unmount command.
  1533. X */
  1534. Xstatic int pfs_match(fo)
  1535. Xam_opts *fo;
  1536. X{
  1537. X    char *prog;
  1538. X    if (!fo->opt_mount || !fo->opt_unmount) {
  1539. X        plog(XLOG_USER, "program: no mount/unmount specified");
  1540. X        return FALSE;
  1541. X    }
  1542. X    prog = strchr(fo->opt_mount, ' ');
  1543. X    if (fo->fs_mtab = strealloc(fo->fs_mtab, prog ? prog+1 : fo->opt_mount))
  1544. X        return TRUE;
  1545. X    return FALSE;
  1546. X}
  1547. X
  1548. Xstatic int pfs_init(mf)
  1549. Xmntfs *mf;
  1550. X{
  1551. X    /*
  1552. X     * Save unmount command
  1553. X     */
  1554. X    if (mf->mf_refc == 1) {
  1555. X        mf->mf_private = (voidp) strdup(mf->mf_fo->opt_unmount);
  1556. X        mf->mf_prfree = free;
  1557. X    }
  1558. X    return 0;
  1559. X}
  1560. X
  1561. Xstatic int pfs_exec(info)
  1562. Xchar *info;
  1563. X{
  1564. X    char **xivec;
  1565. X    int error;
  1566. X    /*
  1567. X     * Split copy of command info string
  1568. X     */
  1569. X    info = strdup(info);
  1570. X    if (info == 0)
  1571. X        return ENOBUFS;
  1572. X    xivec = strsplit(info, '\'');
  1573. X    /*
  1574. X     * Put stdout to stderr
  1575. X     */
  1576. X    (void) fclose(stdout);
  1577. X    (void) dup(fileno(logfp));
  1578. X    if (fileno(logfp) != fileno(stderr)) {
  1579. X        (void) fclose(stderr);
  1580. X        (void) dup(fileno(logfp));
  1581. X    }
  1582. X    /*
  1583. X     * Try the exec
  1584. X     */
  1585. X#ifdef DEBUG
  1586. X    Debug(D_FULL) {
  1587. X        char **cp = xivec;
  1588. X        plog(XLOG_DEBUG, "executing (un)mount command...");
  1589. X        while (*cp) {
  1590. X              plog(XLOG_DEBUG, "arg[%d] = '%s'", cp-xivec, *cp);
  1591. X            cp++;
  1592. X        }
  1593. X    }
  1594. X#endif
  1595. X    if (xivec[0] == 0 || xivec[1] == 0) {
  1596. X        errno = EINVAL;
  1597. X        plog(XLOG_USER, "1st/2nd args missing to (un)mount program");
  1598. X    } else {
  1599. X        (void) execv(xivec[0], xivec+1);
  1600. X    }
  1601. X    /*
  1602. X     * Save error number
  1603. X     */
  1604. X    error = errno;
  1605. X    plog(XLOG_ERROR, "exec failed: %m");
  1606. X
  1607. X    /*
  1608. X     * Free allocate memory
  1609. X     */
  1610. X    free(info);
  1611. X    free(xivec);
  1612. X    /*
  1613. X     * Return error
  1614. X     */
  1615. X    return error;
  1616. X}
  1617. X
  1618. X/*ARGSUSED*/
  1619. Xstatic int pfs_mount(mp)
  1620. Xam_node *mp;
  1621. X{
  1622. X    mntfs *mf = mp->am_mnt;
  1623. X
  1624. X    return pfs_exec(mf->mf_fo->opt_mount);
  1625. X}
  1626. X
  1627. Xstatic int pfs_umount(mp)
  1628. Xam_node *mp;
  1629. X{
  1630. X    mntfs *mf = mp->am_mnt;
  1631. X
  1632. X    return pfs_exec((char *) mf->mf_private);
  1633. X}
  1634. X
  1635. X/*
  1636. X * Ops structure
  1637. X */
  1638. Xam_ops pfs_ops = {
  1639. X    "program",
  1640. X    pfs_match,
  1641. X    pfs_init,
  1642. X    pfs_mount,
  1643. X    pfs_umount,
  1644. X    efs_lookuppn,
  1645. X    efs_readdir,
  1646. X    0, /* pfs_readlink */
  1647. X    0, /* pfs_mounted */
  1648. X    0, /* pfs_umounted */
  1649. X    find_afs_srvr,
  1650. X    FS_BACKGROUND|FS_AMQINFO,
  1651. X    &afs_srvr_list
  1652. X};
  1653. X
  1654. X#endif
  1655. END_OF_FILE
  1656. if test 3296 -ne `wc -c <'pfs_ops.c'`; then
  1657.     echo shar: \"'pfs_ops.c'\" unpacked with wrong size!
  1658. fi
  1659. # end of 'pfs_ops.c'
  1660. fi
  1661. if test -f 'scripts/mk-home-maps' -a "${1}" != "-c" ; then 
  1662.   echo shar: Will not clobber existing file \"'scripts/mk-home-maps'\"
  1663. else
  1664. echo shar: Extracting \"'scripts/mk-home-maps'\" \(3570 characters\)
  1665. sed "s/^X//" >'scripts/mk-home-maps' <<'END_OF_FILE'
  1666. X#!/bin/sh -
  1667. X#
  1668. X# $Id: mk-home-maps,v 5.1 89/11/17 18:24:18 jsp Exp Locker: jsp $
  1669. X#
  1670. X# Copyright (C) 1989 by Jan-Simon Pendry
  1671. X# All Rights Reserved.
  1672. X#
  1673. X# Take a list of user-name/directory pairs and a list of
  1674. X# block-device/mount-point pairs and construct the information
  1675. X# required for amd to automount the whole lot.
  1676. X#
  1677. X# The two mandatory arguments are the names of the files containing
  1678. X# the required information.
  1679. X# The output is placed in a file of the same name with .cf appended
  1680. X#
  1681. Xusage="Usage: $0 dirs part"
  1682. Xif [ $# -ne 2 ]; then
  1683. X    echo $usage 2>&1
  1684. X    exit 1
  1685. Xfi
  1686. Xautoroot=/a
  1687. Xufstype=ufs
  1688. Xopts=rw,grpid,nosuid
  1689. X
  1690. Xdirs="$1"
  1691. Xpart="$2"
  1692. Xsfx=".cf"
  1693. X(
  1694. Xcat $part | sed -e 's/#.*//' -e '/^$/d'
  1695. Xecho ""
  1696. Xcat $dirs | sed -e 's/#.*//' -e '/^$/d'
  1697. X) |
  1698. Xawk '
  1699. XBEGIN {
  1700. X    dirs = "'"$dirs"$sfx'"; part = "'"$part"$sfx'"; fstab = "'"$part"'.fstab"
  1701. X    seen_blank = -1
  1702. X    npart = 0
  1703. X    status = 0
  1704. X    print "# /home" > part
  1705. X    printf "/defaults \\\n\ttype=nfs;opts=%s\n", "'"$opts"'" >> part
  1706. X    print "# /homes" > dirs
  1707. X    printf "/defaults \\\n\ttype=nfs;opts=%s\n", "'"$opts"'" >> dirs
  1708. X    printf "" > fstab
  1709. X}
  1710. Xseen_blank < 0 {
  1711. X    if (NF == 0) {
  1712. X        seen_blank = NR
  1713. X        next
  1714. X    } else {
  1715. X        if (split($1, dev, ":") != 2) {
  1716. X            printf "line %d, $s is not host:/dev/disk\n", NR
  1717. X            status = 1
  1718. X        }
  1719. X#
  1720. X# Generate an /etc/fstab line
  1721. X# dev    /a/dom/host/whatever    type    opts    n n
  1722. X# or
  1723. X# dev    /a/host/whatever    type    opts    n n
  1724. X#
  1725. X        if (NF != 3)
  1726. X            fstype = "'"$ufstype"'"
  1727. X        else
  1728. X            fstype = $3
  1729. X
  1730. X        printf "#\n# Fstab entry for %s\n#\n", dev[1] >> fstab
  1731. X        printf "%s\t%s/%s%s\t%s\t%s\t0 1\n", dev[2], "'"$autoroot"'", dev[1], $2, fstype, "'"$opts"'" >> fstab
  1732. X
  1733. X        device[npart] = dev[2]
  1734. X        partition[npart] = $2
  1735. X        hostname[$2] = dev[1]
  1736. X        n = split($2, v, "/")
  1737. X#        printf "%d: dev = %s, part = %s, n = %d\n", npart, dev[2], $2, n
  1738. X        mc = ""
  1739. X        if (n < 3 || v[2] != "home") {
  1740. X            printf "line %d, %s is not of the form /home/machine/...", NR, $2
  1741. X            status = 1
  1742. X        } else {
  1743. X            mc = v[3]
  1744. X            for (p = 3; p < n; p++) {
  1745. X                if (automap[mc] == "") {
  1746. X                    automap[mc] = mc;
  1747. X                    printf "%s", mc >> part
  1748. X                    if (length(mc) > 7) print " \\" >> part
  1749. X                    printf "\ttype=auto;fs=${map};pref=%s/\n", mc >> part
  1750. X                }
  1751. X                mc = mc "/" v[p+1]
  1752. X            }
  1753. X            printf "%s", mc >> part
  1754. X            if (length(mc) > 7) print " \\" >> part
  1755. X            printf "\trfs=%s;rhost=%s\n", $2, dev[1] >> part
  1756. X            npart++
  1757. X        }
  1758. X    }
  1759. X}
  1760. X
  1761. Xseen_blank >= 0 {
  1762. X    user = $1
  1763. X    dir = $2
  1764. X    n = split(dir, v, "/")
  1765. X#    printf "n = %d, user = %s, dir = %s\n", n, user, dir
  1766. X    if (n < 4 || v[2] != "home") {
  1767. X        printf "Warning: %s (~%s) is not of the form /home/machine/...\n", dir, user
  1768. X        printf "%s", user >> dirs
  1769. X        if (length(user) > 7) print " \\" >> dirs
  1770. X        printf "\ttype=link;fs=%s\n", dir >> dirs
  1771. X    } else {
  1772. X        fs = ""
  1773. X        other = ""
  1774. X        path = "/home"
  1775. X        i = 3;
  1776. X        while (i < n) {
  1777. X            path = path "/" v[i];
  1778. X            for (p = 0; p < npart; p++) {
  1779. X#                printf "checking path %s against partition %s\n", path, partition[p]
  1780. X                if (partition[p] == path) {
  1781. X                    fs = path
  1782. X                    bdev = device[p]
  1783. X                    machine = hostname[fs]
  1784. X#                    printf "machine = %s\n", machine
  1785. X                    break
  1786. X                }
  1787. X            }
  1788. X            i++
  1789. X            if (fs != "")
  1790. X                break
  1791. X        }
  1792. X        if (fs != "") {
  1793. X            rest = ""
  1794. X            while (i <= n) {
  1795. X                rest = rest v[i]
  1796. X#                printf "i = %d, n = %d, rest = %s\n", i, n, rest
  1797. X                if (i != n)
  1798. X                    rest = rest "/"
  1799. X                i++
  1800. X            }
  1801. X
  1802. X#            printf "user=%s, filesys=%s, rest=%s, machine=%s\n", user, fs, rest, machine
  1803. X            printf "%s", user >> dirs
  1804. X            if (length(user) > 7) print " \\" >> dirs
  1805. X            printf "\trfs=%s;rhost=%s;sublink=%s\n", fs, machine, rest >> dirs
  1806. X        } else {
  1807. X            printf "ERROR: Cannot find a partition for %s (~%s)\n", dir, user
  1808. X            status = 1
  1809. X        }
  1810. X    }
  1811. X}
  1812. XEND {
  1813. X    exit(status)
  1814. X}
  1815. X' >&2
  1816. X
  1817. END_OF_FILE
  1818. if test 3570 -ne `wc -c <'scripts/mk-home-maps'`; then
  1819.     echo shar: \"'scripts/mk-home-maps'\" unpacked with wrong size!
  1820. fi
  1821. chmod +x 'scripts/mk-home-maps'
  1822. # end of 'scripts/mk-home-maps'
  1823. fi
  1824. if test -f 'srvr_afs.c' -a "${1}" != "-c" ; then 
  1825.   echo shar: Will not clobber existing file \"'srvr_afs.c'\"
  1826. else
  1827. echo shar: Extracting \"'srvr_afs.c'\" \(3865 characters\)
  1828. sed "s/^X//" >'srvr_afs.c' <<'END_OF_FILE'
  1829. X/*
  1830. X * $Id: srvr_afs.c,v 5.1 89/11/17 18:22:16 jsp Exp Locker: jsp $
  1831. X *
  1832. X * Copyright (c) 1989 Jan-Simon Pendry
  1833. X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  1834. X * Copyright (c) 1989 The Regents of the University of California.
  1835. X * All rights reserved.
  1836. X *
  1837. X * This code is derived from software contributed to Berkeley by
  1838. X * Jan-Simon Pendry at Imperial College, London.
  1839. X *
  1840. X * Redistribution and use in source and binary forms are permitted
  1841. X * provided that the above copyright notice and this paragraph are
  1842. X * duplicated in all such forms and that any documentation,
  1843. X * advertising materials, and other materials related to such
  1844. X * distribution and use acknowledge that the software was developed
  1845. X * by Imperial College of Science, Technology and Medicine, London, UK.
  1846. X * The names of the College and University may not be used to endorse
  1847. X * or promote products derived from this software without specific
  1848. X * prior written permission.
  1849. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1850. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1851. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1852. X *
  1853. X *    %W% (Berkeley) %G%
  1854. X */
  1855. X
  1856. X/*
  1857. X * Automount FS server ("localhost") modeling
  1858. X */
  1859. X
  1860. X#include "am.h"
  1861. X
  1862. Xextern qelem afs_srvr_list;
  1863. Xqelem afs_srvr_list = { &afs_srvr_list, &afs_srvr_list };
  1864. X
  1865. Xstatic fserver *localhost;
  1866. X
  1867. X/*
  1868. X * Find an nfs server for the local host
  1869. X */
  1870. Xfserver *find_afs_srvr P((mntfs *));
  1871. Xfserver *find_afs_srvr(mf)
  1872. Xmntfs *mf;
  1873. X{
  1874. X    fserver *fs = localhost;
  1875. X
  1876. X    if (!fs) {
  1877. X        fs = ALLOC(fserver);
  1878. X        fs->fs_refc = 0;
  1879. X        fs->fs_host = strdup("localhost");
  1880. X        fs->fs_ip = 0;
  1881. X        fs->fs_cid = 0;
  1882. X        fs->fs_pinger = 0;
  1883. X        fs->fs_flags = FSF_VALID;
  1884. X        fs->fs_private = 0;
  1885. X        fs->fs_prfree = 0;
  1886. X
  1887. X        ins_que(&fs->fs_q, &afs_srvr_list);
  1888. X        localhost = fs;
  1889. X    }
  1890. X
  1891. X    fs->fs_refc++;
  1892. X
  1893. X    return fs;
  1894. X}
  1895. X
  1896. X/*------------------------------------------------------------------*/
  1897. X        /* Generic routines follow */
  1898. X
  1899. X/*
  1900. X * Wakeup anything waiting for this server
  1901. X */
  1902. Xvoid wakeup_srvr P((fserver *fs));
  1903. Xvoid wakeup_srvr(fs)
  1904. Xfserver *fs;
  1905. X{
  1906. X    fs->fs_flags &= ~FSF_WANT;
  1907. X    wakeup((voidp) fs);
  1908. X}
  1909. X
  1910. X/*
  1911. X * Called when final ttl of server has expired
  1912. X */
  1913. Xstatic void timeout_srvr P((fserver *fs));
  1914. Xstatic void timeout_srvr(fs)
  1915. Xfserver *fs;
  1916. X{
  1917. X    /*
  1918. X     * If the reference count is still zero then
  1919. X     * we are free to remove this node
  1920. X     */
  1921. X    if (fs->fs_refc == 0) {
  1922. X#ifdef DEBUG
  1923. X        dlog("Deleting file server %s", fs->fs_host);
  1924. X#endif
  1925. X        if (fs->fs_flags & FSF_WANT)
  1926. X            wakeup_srvr(fs);
  1927. X
  1928. X        /*
  1929. X         * Remove from queue.
  1930. X         */
  1931. X        rem_que(&fs->fs_q);
  1932. X        /*
  1933. X         * (Possibly) call the private free routine.
  1934. X         */
  1935. X        if (fs->fs_private && fs->fs_prfree)
  1936. X            (*fs->fs_prfree)(fs->fs_private);
  1937. X
  1938. X        /*
  1939. X         * Free the net address
  1940. X         */
  1941. X        if (fs->fs_ip)
  1942. X            free((voidp) fs->fs_ip);
  1943. X
  1944. X        /*
  1945. X         * Free the host name.
  1946. X         */
  1947. X        free((voidp) fs->fs_host);
  1948. X
  1949. X        /*
  1950. X         * Discard the fserver object.
  1951. X         */
  1952. X        free((voidp) fs);
  1953. X    }
  1954. X}
  1955. X
  1956. X/*
  1957. X * Free a file server
  1958. X */
  1959. Xvoid free_srvr P((fserver *fs));
  1960. Xvoid free_srvr(fs)
  1961. Xfserver *fs;
  1962. X{
  1963. X    if (--fs->fs_refc == 0) {
  1964. X        /*
  1965. X         * The reference count is now zero,
  1966. X         * so arrange for this node to be
  1967. X         * removed in AM_TTL seconds if no
  1968. X         * other mntfs is referencing it.
  1969. X         */
  1970. X        int ttl = (fs->fs_flags & (FSF_DOWN|FSF_ERROR)) ? 19 : AM_TTL;
  1971. X#ifdef DEBUG
  1972. X        dlog("Last hard reference to file server %s - will timeout in %ds", fs->fs_host, ttl);
  1973. X#endif
  1974. X        if (fs->fs_cid) {
  1975. X            untimeout(fs->fs_cid);
  1976. X            /*
  1977. X             * Turn off pinging - XXX
  1978. X             */
  1979. X            fs->fs_flags &= ~FSF_PINGING;
  1980. X        }
  1981. X        /*
  1982. X         * Keep structure lying around for a while
  1983. X         */
  1984. X        fs->fs_cid = timeout(ttl, timeout_srvr, (voidp) fs);
  1985. X        /*
  1986. X         * Mark the fileserver down and invalid again
  1987. X         */
  1988. X        fs->fs_flags &= ~FSF_VALID;
  1989. X        fs->fs_flags |= FSF_DOWN;
  1990. X    }
  1991. X}
  1992. X
  1993. X/*
  1994. X * Make a duplicate fserver reference
  1995. X */
  1996. Xfserver *dup_srvr P((fserver *fs));
  1997. Xfserver *dup_srvr(fs)
  1998. Xfserver *fs;
  1999. X{
  2000. X    fs->fs_refc++;
  2001. X    return fs;
  2002. X}
  2003. END_OF_FILE
  2004. if test 3865 -ne `wc -c <'srvr_afs.c'`; then
  2005.     echo shar: \"'srvr_afs.c'\" unpacked with wrong size!
  2006. fi
  2007. # end of 'srvr_afs.c'
  2008. fi
  2009. if test -f 'ufs_ops.c' -a "${1}" != "-c" ; then 
  2010.   echo shar: Will not clobber existing file \"'ufs_ops.c'\"
  2011. else
  2012. echo shar: Extracting \"'ufs_ops.c'\" \(3269 characters\)
  2013. sed "s/^X//" >'ufs_ops.c' <<'END_OF_FILE'
  2014. X/*
  2015. X * $Id: ufs_ops.c,v 5.1.1.2 90/01/11 17:22:09 jsp Exp Locker: jsp $
  2016. X *
  2017. X * Copyright (c) 1990 Jan-Simon Pendry
  2018. X * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
  2019. X * Copyright (c) 1990 The Regents of the University of California.
  2020. X * All rights reserved.
  2021. X *
  2022. X * This code is derived from software contributed to Berkeley by
  2023. X * Jan-Simon Pendry at Imperial College, London.
  2024. X *
  2025. X * Redistribution and use in source and binary forms are permitted
  2026. X * provided that the above copyright notice and this paragraph are
  2027. X * duplicated in all such forms and that any documentation,
  2028. X * advertising materials, and other materials related to such
  2029. X * distribution and use acknowledge that the software was developed
  2030. X * by Imperial College of Science, Technology and Medicine, London, UK.
  2031. X * The names of the College and University may not be used to endorse
  2032. X * or promote products derived from this software without specific
  2033. X * prior written permission.
  2034. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  2035. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  2036. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  2037. X *
  2038. X *    %W% (Berkeley) %G%
  2039. X */
  2040. X
  2041. X#include "am.h"
  2042. X
  2043. X#ifdef HAS_UFS
  2044. X
  2045. X#include <sys/stat.h>
  2046. X#ifdef NFS_3
  2047. Xtypedef nfs_fh fhandle_t;
  2048. X#endif
  2049. X#include <sys/mount.h>
  2050. X
  2051. X#ifdef UFS_HDR
  2052. X#include UFS_HDR
  2053. X#endif
  2054. X
  2055. X/*
  2056. X * UN*X file system
  2057. X */
  2058. X
  2059. X/*
  2060. X * UFS needs local filesystem and device.
  2061. X */
  2062. Xstatic int ufs_match(fo)
  2063. Xam_opts *fo;
  2064. X{
  2065. X    if (!fo->opt_dev) {
  2066. X        plog(XLOG_USER, "ufs: no device specified");
  2067. X        return 0;
  2068. X    }
  2069. X    /*
  2070. X     * Determine magic cookie to put in mtab
  2071. X     */
  2072. X    fo->fs_mtab = strealloc(fo->fs_mtab, fo->opt_dev);
  2073. X#ifdef DEBUG
  2074. X    dlog("UFS: mounting device \"%s\" on \"%s\"",
  2075. X        fo->opt_dev, fo->opt_fs);
  2076. X#endif
  2077. X
  2078. X    return 1;
  2079. X}
  2080. X
  2081. Xstatic mount_ufs(dir, fs_name, opts)
  2082. Xchar *dir;
  2083. Xchar *fs_name;
  2084. Xchar *opts;
  2085. X{
  2086. X    struct ufs_args ufs_args;
  2087. X    struct mntent mnt;
  2088. X    int flags;
  2089. X
  2090. X    /*
  2091. X     * Figure out the name of the file system type.
  2092. X     */
  2093. X#ifdef M_NEWTYPE
  2094. X    char *type = MOUNT_TYPE_UFS;
  2095. X#else
  2096. X    int type = MOUNT_TYPE_UFS;
  2097. X#endif
  2098. X
  2099. X    bzero((voidp) &ufs_args, sizeof(ufs_args));    /* Paranoid */
  2100. X
  2101. X    /*
  2102. X     * Fill in the mount structure
  2103. X     */
  2104. X    mnt.mnt_dir = dir;
  2105. X    mnt.mnt_fsname = fs_name;
  2106. X    mnt.mnt_type = MTAB_TYPE_UFS;
  2107. X    mnt.mnt_opts = opts;
  2108. X    mnt.mnt_freq = 1;
  2109. X    mnt.mnt_passno = 2;
  2110. X
  2111. X    flags = compute_mount_flags(&mnt);
  2112. X
  2113. X#ifdef ULTRIX_HACK
  2114. X    ufs_args.ufs_flags = flags;
  2115. X    ufs_args.ufs_pgthresh = 64; /* 64K - XXX */
  2116. X    flags &= M_RDONLY;
  2117. X#else
  2118. X    ufs_args.fspec = fs_name;
  2119. X#endif
  2120. X
  2121. X    /*
  2122. X     * Call generic mount routine
  2123. X     */
  2124. X    return mount_fs(&mnt, flags, (caddr_t) &ufs_args, 0, type);
  2125. X}
  2126. X
  2127. X/*ARGSUSED*/
  2128. Xstatic int ufs_mount(mp)
  2129. Xam_node *mp;
  2130. X{
  2131. X    mntfs *mf = mp->am_mnt;
  2132. X
  2133. X    int error;
  2134. X
  2135. X    error = mount_ufs(mf->mf_mount, mf->mf_info, mf->mf_fo->opt_opts);
  2136. X    if (error) {
  2137. X        errno = error;
  2138. X        plog(XLOG_ERROR, "mount_ufs: %m");
  2139. X        return error;
  2140. X    }
  2141. X
  2142. X    return 0;
  2143. X}
  2144. X
  2145. Xstatic int ufs_umount(mp)
  2146. Xam_node *mp;
  2147. X{
  2148. X    mntfs *mf = mp->am_mnt;
  2149. X
  2150. X    return UMOUNT_FS(mf->mf_mount);
  2151. X}
  2152. X
  2153. X/*
  2154. X * Ops structure
  2155. X */
  2156. Xam_ops ufs_ops = {
  2157. X    "ufs",
  2158. X    ufs_match,
  2159. X    0, /* ufs_init */
  2160. X    ufs_mount,
  2161. X    ufs_umount,
  2162. X    efs_lookuppn,
  2163. X    efs_readdir,
  2164. X    0, /* ufs_readlink */
  2165. X    0, /* ufs_mounted */
  2166. X    0, /* ufs_umounted */
  2167. X    find_afs_srvr,
  2168. X    FS_MKMNT|FS_NOTIMEOUT|FS_UBACKGROUND|FS_AMQINFO,
  2169. X    &afs_srvr_list,
  2170. X};
  2171. X
  2172. X#endif /* HAS_UFS */
  2173. END_OF_FILE
  2174. if test 3269 -ne `wc -c <'ufs_ops.c'`; then
  2175.     echo shar: \"'ufs_ops.c'\" unpacked with wrong size!
  2176. fi
  2177. # end of 'ufs_ops.c'
  2178. fi
  2179. echo shar: End of archive 3 \(of 13\).
  2180. cp /dev/null ark3isdone
  2181. MISSING=""
  2182. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
  2183.     if test ! -f ark${I}isdone ; then
  2184.     MISSING="${MISSING} ${I}"
  2185.     fi
  2186. done
  2187. if test "${MISSING}" = "" ; then
  2188.     echo You have unpacked all 13 archives.
  2189.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2190. else
  2191.     echo You still need to unpack the following archives:
  2192.     echo "        " ${MISSING}
  2193. fi
  2194. ##  End of shell archive.
  2195. exit 0
  2196. exit 0 # Just in case...
  2197.